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