UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i6XHSyKTwpm3d13jBfByloRjUm2AkWVPdADVnqMJnk4='
WHERE
key_id = '1c40d3fbbf3e60136e3184de4e19f7b819989dfd16009ca3a6534e9a1f2dc251'
AND (
token = 'i6XHSyKTwpm3d13jBfByloRjUm2AkWVPdADVnqMJnk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)