UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NTiurjiznAmMNmnSgXrWujDM30e+zvgmgF2kwC9WyDI='
WHERE
key_id = '6f4e06921862f5970b040c62d84db78713075e52fa6b9c46c406b5768de83973'
AND (
token = 'NTiurjiznAmMNmnSgXrWujDM30e+zvgmgF2kwC9WyDI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)