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