UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b/nbc07qtItPcjezvlmZeR2RPBrcPzqisjn/O4MmyzA='
WHERE
key_id = 'c166fa53197a0b33dd1839ea2fc200eb69a9034cf159e4ae6198e995a392a7d9'
AND (
token = 'b/nbc07qtItPcjezvlmZeR2RPBrcPzqisjn/O4MmyzA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)