UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '36b1RtReKLDXdENaqHz24c0EnuGPpHw3WyJDFQp2VMg='
WHERE
key_id = 'b863cadb9ab9b95306f69d2b17135a0e4bcbdbadf88145255a81e5c7bbb86ec1'
AND (
token = '36b1RtReKLDXdENaqHz24c0EnuGPpHw3WyJDFQp2VMg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)