UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm/T8lsv6csO8+nSzjJl7F4Rg5Kt+XmA9L6VVi5qQSuM=' 
WHERE 
  key_id = '62a6820a413a940c038fd820683bf901f07e099b361d50176963ea90862e2f1c' 
  AND (
    token = 'm/T8lsv6csO8+nSzjJl7F4Rg5Kt+XmA9L6VVi5qQSuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041