UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qpk4mf/jfv15J+t1es675kHYIHeghBxMVl++ZlMC5HQ='
WHERE
key_id = 'd097c9319a890e4c7a53c13634cd2cb8293ba6c6597e6c3607d73d877b4d8d8e'
AND (
token = 'Qpk4mf/jfv15J+t1es675kHYIHeghBxMVl++ZlMC5HQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)