UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GM7AjiDTtDpRajqQOJZYmqhEPJyk6IRejotwB1sl9wM=' 
WHERE 
  key_id = 'c15ab1608d3a8be7f39143e2d67b22aff04e88deda9372897fb354e11e766f99' 
  AND (
    token = 'GM7AjiDTtDpRajqQOJZYmqhEPJyk6IRejotwB1sl9wM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032