UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8lYcGRTBOOY22BQ7lw3lG7AOdH0k5o3CzhBxMhLDqSk='
WHERE
key_id = '00318475b51e518014aa98be9e1f811cb79444d97071ee377f4b42ccdd81c07d'
AND (
token = '8lYcGRTBOOY22BQ7lw3lG7AOdH0k5o3CzhBxMhLDqSk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)