UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'phemqn7Skk7u2rxMxTJwr2IOjXgoYvOTLDWx1I+c5X8='
WHERE
key_id = 'bc2c520b05618fd33a0520d48c8780978901aa9ed1d4832346892cfb90dc1a3a'
AND (
token = 'phemqn7Skk7u2rxMxTJwr2IOjXgoYvOTLDWx1I+c5X8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)