UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q6YyrjK+la14ZLr7Moxbco/yoPhPetY0/8zMeo+gUKE=' 
WHERE 
  key_id = '9e348a3ebdc7c64cc8efee57e31925aac12d614e5b5c0713af0dc5eb2f1cec4f' 
  AND (
    token = 'q6YyrjK+la14ZLr7Moxbco/yoPhPetY0/8zMeo+gUKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034