UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pWmrm2gDZBD7yz3UeLsZL1ekX6QgRpUAhoh5JW3LrzA='
WHERE
key_id = 'a438fe70bf0e22275b63b9be5e9cb1beeb85e08aa18a52025d4dc87979aa505e'
AND (
token = 'pWmrm2gDZBD7yz3UeLsZL1ekX6QgRpUAhoh5JW3LrzA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)