UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o7LKppa1yIqU/dz7lWUZN9wTWwZ51nChZX2eF1+oHb8='
WHERE
key_id = 'c14e4e9f1b3b4ec58c362a486b39f76883f1c5a1c83b66389b691117868d03ab'
AND (
token = 'o7LKppa1yIqU/dz7lWUZN9wTWwZ51nChZX2eF1+oHb8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)