UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J4mzzhaEQ5h/SzS4bFEYLXawjcE72uVLTsxRRzrIDQU='
WHERE
key_id = 'ada45adf03ca39cfa353d01363cecb5cce55f0e7c46b64d464b7c6b4270457be'
AND (
token = 'J4mzzhaEQ5h/SzS4bFEYLXawjcE72uVLTsxRRzrIDQU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)