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