UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MKpi/WdSB3jMu8DQWa8gdkzxiPivDgD1yGMfWx890xA=' 
WHERE 
  key_id = '0f962f5c84889edb863602628213160e058bdc194af5c0f62731255b23a0da02' 
  AND (
    token = 'MKpi/WdSB3jMu8DQWa8gdkzxiPivDgD1yGMfWx890xA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058