UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vT70jef1gRj7+6kJA743Lnfyqw0erganbJXjm6FZdUs=' 
WHERE 
  key_id = '5d7fd69b087d1056a1610b0b81e9fedc804f08d19b6d1ed6a77734371fa07416' 
  AND (
    token = 'vT70jef1gRj7+6kJA743Lnfyqw0erganbJXjm6FZdUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022