UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kg2mhFPDJ0rGsrLipeDsiELTIdYXpFZZQfbsdRes1cc='
WHERE
key_id = '2f83d2e3f6e9426801c182200ea2e97596c30d1c3f977fb7c42bee539025b5b4'
AND (
token = 'kg2mhFPDJ0rGsrLipeDsiELTIdYXpFZZQfbsdRes1cc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)