UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'taTyNHe1WS7us7McyAEUhhE8xH/dC3K6Tz5uMrDM85o='
WHERE
key_id = '9a70645eb08f0aa6f293697bcabc9171496a57cadac0c5e1d7d15b308ec6e393'
AND (
token = 'taTyNHe1WS7us7McyAEUhhE8xH/dC3K6Tz5uMrDM85o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)