UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b0edepbw6IC9y8iM64ODZC4uVvNu3X1LX0eV/YtTKMA=' 
WHERE 
  key_id = '859d9a2756071eddf89e1a92b326fad7f10a1b0c007fa55f1322c28b4aa03780' 
  AND (
    token = 'b0edepbw6IC9y8iM64ODZC4uVvNu3X1LX0eV/YtTKMA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039