UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5045rXbK5CgjzpmmfjkwdQXnmo3KFyzgPE3qKbTaT3M='
WHERE
key_id = '504e63edf2701a6b6fc8c6fc7e9d93fd9f34e4da63b50debe321a4a8b57b9923'
AND (
token = '5045rXbK5CgjzpmmfjkwdQXnmo3KFyzgPE3qKbTaT3M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)