UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6b6pMPJrnSMjEP2AN/BUJptmUWKOzmd+QpfRS/unvIc=' 
WHERE 
  key_id = '3c959395bd19db782a7afcdd4ab1c4fedc35e85cf86261d172509ae4d243d872' 
  AND (
    token = '6b6pMPJrnSMjEP2AN/BUJptmUWKOzmd+QpfRS/unvIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032