UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xHk5X6hpqvs1D7g6A5JPsm4sQTmedyWG8xHp6RAz6cM='
WHERE
key_id = '1156ceb7edc2877a0686bfee5705f510438fabe96494595d02e2dd896a0a1e9b'
AND (
token = 'xHk5X6hpqvs1D7g6A5JPsm4sQTmedyWG8xHp6RAz6cM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)