UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZnEYbAUjmme+C8fAUg6M0J1Iigl054q2h8+k6msn+1E='
WHERE
key_id = 'a21be679ec9acdde8dca5a541ae956ade3c914c1bf2a3a8c0072c36006b5aea9'
AND (
token = 'ZnEYbAUjmme+C8fAUg6M0J1Iigl054q2h8+k6msn+1E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)