UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+3pWwreqA2y/H4sy5HbgvyeAEdrlYA+xBRBEQodqhSA=' 
WHERE 
  key_id = '45e4e4a695af44037b9c63a110d167460ec282329c18fae74d615a4f9057e399' 
  AND (
    token = '+3pWwreqA2y/H4sy5HbgvyeAEdrlYA+xBRBEQodqhSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034