UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uueXPvS5QS8PAYqWsYLkoHlq8p5wALJYXpYd60N1DYs='
WHERE
key_id = 'edd429cbd5ca33cdca567ea65231693ef87874a74c572aef78a81c7be4fe1bf6'
AND (
token = 'uueXPvS5QS8PAYqWsYLkoHlq8p5wALJYXpYd60N1DYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)