UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9LH/zndfGLwlTTkzSeliHs1NAQAsBHhs1Fpj3L6b2ss=' 
WHERE 
  key_id = '247e6bf4bc567187ec2bffc4050c5fd44e6ac2dd707e3865ba9d70011612ddbc' 
  AND (
    token = '9LH/zndfGLwlTTkzSeliHs1NAQAsBHhs1Fpj3L6b2ss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022