UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IPGgG2+zGSTjCDDT9jcnAAxEnOaLPIRSbBUxQMMMdBM=' 
WHERE 
  key_id = '96482e96b0d501958f45c6fcbedd16e4987721bfbacca56d19c26bdb072d01e9' 
  AND (
    token = 'IPGgG2+zGSTjCDDT9jcnAAxEnOaLPIRSbBUxQMMMdBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034