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