UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BQBGbL1ESabQ+4XGjenSuL+avLmPP2H1yXn3B54f2rw=' 
WHERE 
  key_id = 'f5858c812cedbe733e9ff2af3e2a41a42fa850e14b5e2b42030f305e90a2f182' 
  AND (
    token = 'BQBGbL1ESabQ+4XGjenSuL+avLmPP2H1yXn3B54f2rw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040