UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IlkDEkny05ElMIVbKegwSsEqDlH1O35LILEGZy2L9lg=' 
WHERE 
  key_id = '5d081d5e0047d7d41c532b0f011b559118d95f58b0b96cbd0c0070c3a425119f' 
  AND (
    token = 'IlkDEkny05ElMIVbKegwSsEqDlH1O35LILEGZy2L9lg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027