UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ou7F5jn+AZMptS+gFhbd1SumW2qaUsK2YWFoY4CYby0=' 
WHERE 
  key_id = '9495df4582b91149cb9cdbbf6eb6f36ff398e88cd10a4c36972fca9690d7bee3' 
  AND (
    token = 'Ou7F5jn+AZMptS+gFhbd1SumW2qaUsK2YWFoY4CYby0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030