UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pPdDVp0NKEhp5rrG98gaBk0XcZhbyvR8ZW8SNt7hzOo='
WHERE
key_id = '5693fd0c30b9545817720625faac6a674f4a4a1a7dd0a07a30c322cda86588cc'
AND (
token = 'pPdDVp0NKEhp5rrG98gaBk0XcZhbyvR8ZW8SNt7hzOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)