UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rfwO/wz59rMBDXJKWY40P9j+t9fA0dejJjIa1hdBoTE='
WHERE
key_id = 'af4ea78512e64e45be129e6953698d6d1c29efca1f2b4cc2df2950f18d17e3c3'
AND (
token = 'rfwO/wz59rMBDXJKWY40P9j+t9fA0dejJjIa1hdBoTE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)